package com.woniuxy.propertyjava.service.impl;


import com.woniuxy.propertyjava.dao.HousinginformationDao;
import com.woniuxy.propertyjava.entity.Housinginformation;

import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.service.HousinginformationService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

/**
 * (Housinginformation)表服务实现类
 *
 * @author makejava
 * @since 2022-07-04 19:33:22
 */
@Service("housinginformationService")
public class HousinginformationServiceImpl implements HousinginformationService {
    @Resource
    private HousinginformationDao housinginformationDao;

    @Override
    public Housinginformation queryById(Integer hiid) {

        return this.housinginformationDao.queryById(hiid);
    }

    @Override
    public PageBean<Housinginformation> queryByPage(int pageIndex, int pageSize) {
        PageBean<Housinginformation> pageBean=new PageBean<>();
        pageBean.setBeanList(housinginformationDao.queryAllByLimit(pageIndex, pageSize));
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecode(housinginformationDao.count(new Housinginformation()));
        return pageBean;
    }

    @Override
    public PageBean<Housinginformation> queryByCondition(int pageIndex, int pageSize, Housinginformation housinginformation) {
        PageBean<Housinginformation> pageBean=new PageBean<>();
        List<Housinginformation> housinginformations=housinginformationDao.queryAllByCondtion(pageIndex, pageSize, housinginformation);
        pageBean.setBeanList(housinginformations);
        pageBean.setPageIndex(pageIndex);
        pageBean.setPageSize(pageSize);
        pageBean.setTotalRecode(housinginformationDao.count(housinginformation));
        return pageBean;
    }


    @Override
    public List<Housinginformation> querAll() {
        return this.housinginformationDao.queryAll();
    }

    @Override
    public Housinginformation insert(Housinginformation housinginformation) {
        housinginformationDao.insert(housinginformation);
        return null;
    }

    @Override
    public Housinginformation update(Housinginformation housinginformation) {
        housinginformationDao.update(housinginformation);
        return null;
    }

    @Override
    public boolean deleteById(Integer hiid) {
        return this.housinginformationDao.deleteById(hiid) > 0;
    }
}
